package com.pactera.madp.admin.api.feign;

import com.pactera.madp.admin.api.entity.SysDept;
import com.pactera.madp.admin.api.entity.SysWxDeptRelation;
import com.pactera.madp.common.core.constant.SecurityConstants;
import com.pactera.madp.common.core.constant.ServiceNameConstants;
import com.pactera.madp.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 远程系统同步服务
 */
@FeignClient(contextId = "remoteSyncSysService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteSyncSysService {

    /**
     * 企业微信部门与系统部门关联查询
     * @param from
     * @return
     */
    @GetMapping("/dept/relations")
    R<List<SysWxDeptRelation>> getSysWxRelations(@RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 通过企业微信id查询系统部门id
     * @param id
     * @return
     */
    @GetMapping("/dept/relation/{id}")
    R<SysDept> getSysWxRelationById(@PathVariable("id") Integer id, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 企业微信部门远程同步到系统部门
     * @param param
     * @param from
     * @return
     */
    @PostMapping("/dept/sync")
    R<Map<Integer,Integer>> onSyncWxDept(@RequestBody Map<String,String> param, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 企业微信成员远程同步到系统用户
     * @param param
     * @param from
     */
    @PostMapping("/user/sync")
    void onSyncWxEmp(@RequestBody Map<String,String> param, @RequestHeader(SecurityConstants.FROM) String from);
	/**
     * 获取系统部门列表
     * @param ids
     * @return
     */
    @PostMapping("/dept/list")
    R<List<SysDept>> getSysDeptList(@RequestBody List<Integer> ids, @RequestHeader(SecurityConstants.FROM) String from);
}
